print("------------ shuffle ------------")
var array1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// 操作原数组
array1.shuffle()
print(array1)

print("------------ shuffled ------------")
let array2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// 不会改变原数组
let array3 = array2.shuffled()
print(array2)
print(array3)

print("------------ reverse ------------")
var array4 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// 操作原数组
array4.reverse()
print(array4)

print("------------ reversed ------------")
let array5 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// 不会改变原数组
let array6 = array5.reversed()
// 返回ReversedCollection<Array<Int>>(_base: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 不是一个Array
print(array5)
print(array6)

print("------------ partition ------------")
// 前面以部分是复合条件的元素, 后面一部分是不符合条件的元素, 会改变原数组, index是两部分的分开位置的下标
var array7 = [1, 6, 7, 8, 3, 2, 4, 5, 9, 10]
let index = array7.partition{ (element) -> Bool
    in
    element > 4
}
print(array7)
print(index)

print("------------ sort ------------")
var array8 = [1, 6, 7, 8, 3, 2, 4, 5, 9, 10]
array8.sort()
print(array8)

print("------------ sorted ------------")
let array9 = [1, 6, 7, 8, 3, 2, 4, 5, 9, 10]
let arr10 = array9.sorted()
print(array9)
print(arr10)

print("------------ swapAt ------------")
var array11 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
array11.swapAt(2, 3)
print(array11)
